When /^on the page exists following button "([^\"]*)"="([^\"]*)"$/ do |componentTag, tagValue|
  sleep(1)
  if($browser.button(componentTag.to_sym, tagValue).exists?.to_s=="false")
    raise("cannot locate button with "+componentTag+" = "+tagValue)
  end
end

And /^select "([^\"]*)" value in ([^\"]*) list component with "([^\"]*)"="([^\"]*)"$/ do |selectValue, usrfriendlyName, componentTag, tagValue|
  $browser.select_list(componentTag.to_sym, tagValue).set(selectValue)
end

When /^on the page exists following link "([^\"]*)"="([^\"]*)" click it$/ do |componentTag, tagValue|
  sleep(1)
  if($browser.link(componentTag.to_sym, tagValue).exists?.to_s=="false")
    raise("cannot locate button with "+componentTag+" = "+tagValue)
  else
    $browser.link(componentTag.to_sym, tagValue).click
  end
end

When /^on the page exists following link "([^\"]*)"="([^\"]*)" click and press "([^\"]*)" on pop up$/ do |componentTag, tagValue, btn|
  $popup = Thread.new { check_for_popups }  # start popup handler
  at_exit { Thread.kill($popup) }           # kill thread on exit of main application
  $browser.link(componentTag.to_sym, tagValue).click_no_wait
  sleep(3)
end

When /^verify if value in 'Actions:' list component with "([^\"]*)"="([^\"]*)" = "([^\"]*)"$/ do |componentTag, tagValue, selectValue|
  assert_equal(selectValue, $browser.select_list(componentTag.to_sym, tagValue).getSelectedItems.to_s())
end

When /^on the page exists following button "([^\"]*)"="([^\"]*)" click and press "([^\"]*)" on pop up$/ do |componentTag, tagValue, btn|
  $popup = Thread.new { check_for_popups }  # start popup handler
  at_exit { Thread.kill($popup) }           # kill thread on exit of main application
  $browser.button(componentTag.to_sym, tagValue).click_no_wait
  sleep(3)
end